package com.hgyc.mom.wms.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hgyc.mom.common.vo.Result;
import com.hgyc.mom.core.mybatis.QueryWrapperUtil;
import com.hgyc.mom.wms.entity.WmsProductReturnDetail;
import com.hgyc.mom.wms.service.WmsProductReturnDetailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 生产退料单明细Controller
 *
 * @author fwj
 * @since 2025-07-09
 */
@Tag(name = "生产退料单明细控制器", description = "生产退料单明细控制器")
@RestController
@RequestMapping("/wms/product/return/detail")
public class WmsProductReturnDetailController {
    @Autowired
    private WmsProductReturnDetailService wmsProductReturnDetailService;


    @Operation(summary = "查询生产退料单明细树列表", description = "查询生产退料单明细树列表")
    @PostMapping("/list")
    public Result<List<WmsProductReturnDetail>> pageList(@Parameter(description = "查询参数") @RequestBody WmsProductReturnDetail wmsProductReturnDetail) {
        QueryWrapper<WmsProductReturnDetail> wrapper = QueryWrapperUtil.build(wmsProductReturnDetail);
        List<WmsProductReturnDetail> list = wmsProductReturnDetailService.list(wrapper);
        return Result.success(list);
    }

    @Operation(summary = "获取生产退料单明细详细信息", description = "获取生产退料单明细详细信息")
    @GetMapping(value = "/{id}")
    public Result getInfo(@Parameter(description = "生产退料单明细ID") @PathVariable("id") Long id) {
        return Result.success(wmsProductReturnDetailService.getById(id));
    }

}